import { NgModule, Inject } from '@angular/core';
import { SharedModule } from '@shared';
import { SystemRoutingModule } from './system-routing.module';
import { ALAIN_I18N_TOKEN } from '@delon/theme';
import { I18NService } from '@core';
import { default as zh_CN } from './_i18n/zh-CN';
import { default as en_US } from './_i18n/en-US';
import { SystemLayoutComponent } from './_layout/layout.component';
import { SystemLogsComponent } from './logs/logs.component';
import { SystemDictComponent } from './sysdict/sysdict.component';
import { SystemDictEditComponent } from './sysdict/dictedit/dictedit.component';
import { SysDictItemComponent } from './sysdict/view/sysdict-item.component';
import { SysDictItemEditComponent } from './sysdict/view/edit/sysdict-item-edit.component';
import { SysParamComponent } from './sysparam/sysparam.component';
import { SysParamEditComponent } from './sysparam/edit/sysparam-edit.component';
import { SystemTokenComponent } from './token/token.component';
import { QuartzJobComponent } from './job/quartz.component';
import { QuartzEditComponent } from './job/edit/quartz-edit.component';
import { JobLogComponent } from './job/view/job-log.component';
import { DataSourceComponent } from './datasource/datasource.component';
import { DataSourceEditComponent } from './datasource/edit/datasource-edit.component';
import { QuartzMsgModalComponent } from './job/msg/quartz-msg-modal.component';

const COMPONENTS = [
  SystemLayoutComponent,
  SystemLogsComponent,
  SystemDictComponent,
  SysDictItemComponent,
  SysParamComponent,
  SystemTokenComponent,
  QuartzJobComponent,
  DataSourceComponent,
];
const COMPONENTS_NOROUNT = [
  SystemDictEditComponent,
  SysDictItemEditComponent,
  SysParamEditComponent,
  QuartzEditComponent,
  JobLogComponent,
  DataSourceEditComponent,
  QuartzMsgModalComponent,
];

@NgModule({
  imports: [SharedModule, SystemRoutingModule],
  declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT],
  entryComponents: COMPONENTS_NOROUNT,
})
export class SystemModule {
  constructor(@Inject(ALAIN_I18N_TOKEN) i18n: I18NService) {
    i18n.load('zh-CN', zh_CN);
    i18n.load('en-US', en_US);
  }
}
